<!DOCTYPE html>
<html>
<head>
<#include "/common/freemarker/include_css.ftl">
<title>编辑</title>
</head>


<body>
	<div class="panel panel-default">
	   <div class="panel-heading">
	       <div class="panel-title">编辑</div>
	   </div>
	   <div clas="panel-body">
	      <div class="row">
	           <div class="col-md-12">
	               <br>
	               <form id="contentForm" class="form-horizontal"  action="<@context/>ued/tpltb3/save.do" method="POST"  >
	                	<input type="hidden" name="id" value='<#if rhs["obj"]?exists>${rhs["obj"].id?if_exists}</#if>' />
						 
	                    <div class="form-group">
	                    	<label class="col-md-2 control-label">标题 <font color="red"> *</font></label>
	                        <div class="col-md-9">
								<input type="text"  class="input-sm form-control required" id="title" name="title" value='<#if rhs["obj"]?exists>${rhs["obj"].title?if_exists}</#if>'    minlength="2"  />
	                    	</div>              	
	                    </div> 
	                      
	                     <div class="form-group">
	                    	<label class="col-md-2 control-label">完成期限 <font color="red"> *</font></label>
	                        <div class="col-md-9">
	                   			<input type="text" class="input-sm form-control" id="deadline" name="deadline" value='<#if rhs["obj"]?exists && rhs["obj"].deadline?exists>${rhs["obj"].deadline?string("yyyy-MM-dd HH:mm:ss")}</#if> ' 
								onclick="javascript:WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"   class="{required:true}"/>
						     </div>              	
	                    </div>
	                   
	                    <div class="form-group">
	                    	<label class="col-md-2  control-label">详细内容<font color="red"> *</font></label>
	                        <div class="col-md-9">
								<textarea class="form-control required" rows="3" id="content" name="content"     minlength="2" maxlength="1000"  ><#if rhs["obj"]?exists>${rhs["obj"].content?if_exists}</#if></textarea>
	                    	</div>              	
	                    </div>  
	                  
	                    <div class="form-group">
	                    	<label class="col-md-2 control-label">附件</label>
	                        <div class="col-md-9">
	                            <#assign tmps="">
	                        	<#if rhs["obj"]?exists>
									<#assign tmps=rhs["obj"].attachment?if_exists>
	                        	</#if>
	                   			 <@attachment  id="attachment" name="attachment" value=tmps namePrefix=""  showType="all" /> 
						     </div>              	
	                    </div>
	                    <div class="form-group">
	                    	<label class="col-md-2 control-label">审批人 <font color="red"> </font></label>
	                        <div class="col-md-9">
			  			  		<div class="input-group"> 
				  			  		<input type="text" name="assignerText" class="form-control"  readonly value="<#if rhs["obj"]?exists && rhs["obj"].assigner?exists>${eaUtils.getUserNameById(rhs["obj"].assigner)}</#if>">
							  		<input type="hidden" name="assigner" readonly   value="<#if rhs["obj"]?exists>${rhs["obj"].assigner?if_exists}</#if>">
							  		<input type="hidden" name="assignerAccount" readonly class="btn btn-secondary  btn-default"  value="<#if rhs["obj"]?exists && rhs["obj"].assigner?exists>${eaUtils.getUserAccountById(rhs["obj"].assigner)}</#if>">
							  		<span class="input-group-btn">
										<INPUT type="button" value="选 择" id="btnSelect" name="btnSelect" class="btn btn-secondary  btn-default" onclick="selectUserAllInOne('assigner','assignerText','assignerAccount','','false')">
				                   	 </span>
								</div>
	                    	</div>              	
	                    </div> 
	                                                        
	                    <div class="form-group">
	                    	<div class="col-md-offset-2 col-md-10">
	                    		<input type="button" class="btn btn-sm btn-primary" id="submitBtn" value="保 存"/>
	                    		<input type="button" class="btn btn-sm btn-default" value="返 回" onclick="javascript:history.go(-1)"/>
	                    	</div>
	                    </div>
	              </form>
	        </div>
	    </div>
	</div>
	<#--  公共js -->
	<#include "/common/freemarker/include_js.ftl">
	<#--  页面自己的js -->
	<script type="text/javascript" src="<@context/>common/ckeditor_4.5.4_full/ckeditor/ckeditor.js"></script>
	 
 
	<script>
		$(document).ready(function() {
				var form = $('#contentForm');
		  		form.validate({
					rules: {
		    			"deadline":{
			    			required: true,
		    			}
					}
			
			    });
		  		
				 CKEDITOR.replace( 'content',
					        {
					             toolbar :
					             [
					                //加粗     斜体，     下划线      穿过线      下标字        上标字
					                ['Bold','Italic','Underline','Strike','Subscript','Superscript'],
					                // 数字列表          实体列表            减小缩进    增大缩进
					                ['NumberedList','BulletedList','-','Outdent','Indent'],
					                //左对 齐             居中对齐          右对齐          两端对齐
					                ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
					                //超链接  取消超链接 锚点
					                ['Link','Unlink','Anchor'],
					                //图片    flash    表格       水平线            表情       特殊字符        分页符
					                ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
					                '/',
					                // 样式       格式      字体    字体大小
					                ['Styles','Format','Font','FontSize'],
					                //文本颜色     背景颜色
					                ['TextColor','BGColor'],
					                //全屏           显示区块
					                ['Maximize', 'ShowBlocks','-']
					             ]
					        }
				);
		
		});
		
		
		$("#submitBtn").click(function() {
			  if(!$("#contentForm").valid()){
			    	 return;
			  }
			  /**
			  var  school= $('input[name="school"]:checked').val();
			  if (typeof(school) == "undefined" || school=="" ){
			      alert("请选择学校");
			      return;
			   }else{
			       $('input[name="bfobject.school"]').val(school);
			   }
			   
			  $('input[name="bfobject.school"]').val(school);
			  **/
			  var oEditor = CKEDITOR.instances.content;
			  if(""==oEditor.getData()){
					art.dialog.alert("详细内容不能为空!");
					return false;
			  }		
				 
				 
			  $("#submitBtn").attr("value", "提交中..."); 
			  $('#contentForm').find(":button").attr("disabled", true);
			  $("#contentForm").submit(); //提交表单，如果不写，即便通过表单也不会自动提交 
		})
		 
	</script>
 
</body>
</html>

 

